Optimal. Leaf size=101 \[ \frac{(-B+i A) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{(A+3 i B) \tan (c+d x)}{2 a d}+\frac{(-B+i A) \log (\cos (c+d x))}{a d}+\frac{x (A+3 i B)}{2 a} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.124644, antiderivative size = 101, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 34, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.088, Rules used = {3595, 3525, 3475} \[ \frac{(-B+i A) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{(A+3 i B) \tan (c+d x)}{2 a d}+\frac{(-B+i A) \log (\cos (c+d x))}{a d}+\frac{x (A+3 i B)}{2 a} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3595
Rule 3525
Rule 3475
Rubi steps
\begin{align*} \int \frac{\tan ^2(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=\frac{(i A-B) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{\int \tan (c+d x) (2 a (i A-B)+a (A+3 i B) \tan (c+d x)) \, dx}{2 a^2}\\ &=\frac{(A+3 i B) x}{2 a}-\frac{(A+3 i B) \tan (c+d x)}{2 a d}+\frac{(i A-B) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{(i A-B) \int \tan (c+d x) \, dx}{a}\\ &=\frac{(A+3 i B) x}{2 a}+\frac{(i A-B) \log (\cos (c+d x))}{a d}-\frac{(A+3 i B) \tan (c+d x)}{2 a d}+\frac{(i A-B) \tan ^2(c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end{align*}
Mathematica [B] time = 4.35677, size = 240, normalized size = 2.38 \[ \frac{(\cos (d x)+i \sin (d x)) (A+B \tan (c+d x)) \left ((B-i A) (\cos (c)-i \sin (c)) \cos (2 d x)+2 d x (A+3 i B) (\cos (c)+i \sin (c))+(A+i B) (-\cos (c)+i \sin (c)) \sin (2 d x)+2 i (A+i B) (\cos (c)+i \sin (c)) \log \left (\cos ^2(c+d x)\right )+4 (A+i B) (\cos (c)+i \sin (c)) \tan ^{-1}(\tan (d x))+4 d x (A+i B) \tan (c) (\sin (c)-i \cos (c))-4 A d x \sec (c)-4 i B d x \sec (c)+4 B (\tan (c)-i) \sin (d x) \sec (c+d x)\right )}{4 d (a+i a \tan (c+d x)) (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.028, size = 137, normalized size = 1.4 \begin{align*}{\frac{-iB\tan \left ( dx+c \right ) }{ad}}-{\frac{A}{2\,ad \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{{\frac{i}{2}}B}{ad \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{{\frac{3\,i}{4}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) A}{ad}}+{\frac{5\,\ln \left ( \tan \left ( dx+c \right ) -i \right ) B}{4\,ad}}-{\frac{B\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{4\,ad}}-{\frac{{\frac{i}{4}}A\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{ad}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.4707, size = 362, normalized size = 3.58 \begin{align*} \frac{2 \,{\left (3 \, A + 5 i \, B\right )} d x e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (2 \,{\left (3 \, A + 5 i \, B\right )} d x - i \, A + 9 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} +{\left ({\left (4 i \, A - 4 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (4 i \, A - 4 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i \, A + B}{4 \,{\left (a d e^{\left (4 i \, d x + 4 i \, c\right )} + a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 7.31978, size = 150, normalized size = 1.49 \begin{align*} \frac{2 B e^{- 2 i c}}{a d \left (e^{2 i d x} + e^{- 2 i c}\right )} + \frac{\left (\begin{cases} 3 A x e^{2 i c} - \frac{i A e^{- 2 i d x}}{2 d} + 5 i B x e^{2 i c} + \frac{B e^{- 2 i d x}}{2 d} & \text{for}\: d \neq 0 \\x \left (3 A e^{2 i c} - A + 5 i B e^{2 i c} - i B\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i c}}{2 a} + \frac{\left (i A - B\right ) \log{\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.63444, size = 136, normalized size = 1.35 \begin{align*} \frac{\frac{{\left (-i \, A - B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a} - \frac{{\left (3 i \, A - 5 \, B\right )} \log \left (-i \, \tan \left (d x + c\right ) - 1\right )}{a} - \frac{4 i \, B \tan \left (d x + c\right )}{a} - \frac{-3 i \, A \tan \left (d x + c\right ) + 5 \, B \tan \left (d x + c\right ) - A - 3 i \, B}{a{\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]